#!/usr/bin/env bash

ROS_DISTRO_TO_INSTALL="noetic"
INSTALL_PATH=~/interbotix_ws

sudo apt install ros-noetic-dynamixel-sdk -y
sudo apt install ros-noetic-moveit-commander -y
sudo apt install ros-noetic-apriltag-ros -y
sudo apt install ros-noetic-joint-trajectory-controller -y
sudo apt install ros-noetic-joy -y
sudo apt install ros-noetic-realsense2-camera -y
sudo apt install ros-noetic-effort-controllers -y
sudo apt install ros-noetic-moveit-visual-tools -y


echo -e "正在安装Interbotix Arm机械臂功能包..."
echo -e "Installing ROS packages for the Interbotix Arm..."
mkdir -p $INSTALL_PATH/src
cd $INSTALL_PATH/src
git clone http://mirror.ghproxy.com/https://github.com/Interbotix/interbotix_ros_core.git -b noetic
git clone http://mirror.ghproxy.com/https://github.com/Interbotix/interbotix_ros_manipulators.git -b noetic
git clone http://mirror.ghproxy.com/https://github.com/Interbotix/interbotix_ros_toolboxes.git -b noetic

rm interbotix_ros_core/interbotix_ros_xseries/CATKIN_IGNORE
rm interbotix_ros_manipulators/interbotix_ros_xsarms/CATKIN_IGNORE

rm interbotix_ros_manipulators/interbotix_ros_xsarms/interbotix_xsarm_perception/CATKIN_IGNORE
rm interbotix_ros_toolboxes/interbotix_perception_toolbox/CATKIN_IGNORE

rm interbotix_ros_toolboxes/interbotix_xs_toolbox/CATKIN_IGNORE
rm interbotix_ros_toolboxes/interbotix_common_toolbox/interbotix_moveit_interface/CATKIN_IGNORE

#matlab 安装有的问题
#cd interbotix_ros_toolboxes
#git submodule update --init third_party_libraries/ModernRobotics

#cd ..
cd ~/interbotix_ws/src
cd interbotix_ros_core/interbotix_ros_xseries/interbotix_xs_sdk
sudo cp 99-interbotix-udev.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

cd ~/interbotix_ws
rosdep install --from-paths src --ignore-src -r -y

catkin_make


#安装Aloha
cd ~/interbotix_ws/src
git clone http://mirror.ghproxy.com/https://github.com/tonyzhaozh/aloha.git
git clone http://mirror.ghproxy.com/https://github.com/tonyzhaozh/act.git
